﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HW1_FormCalc
{
    public partial class Form1 : Form
    {
        double a, b;
        double res;
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            a = Convert.ToDouble(textBox1.Text);
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            b = Convert.ToDouble(textBox2.Text);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            textBox3.Text = res.ToString();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (b == 0)
                res = double.MaxValue;
            else
                res = a / b;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            res = a * b;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            res = a - b;
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            textBox3.Text= Convert.ToString(res);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            res = a + b;
        }
    }
}
